import { ss } from '@/utils/storage'

const LOCAL_NAME = 'noticeStorage'

export interface NoticeInfo {
  title: string
  content: string
	id:bigint
}

export interface NoticeState {
  noticeInfo: NoticeInfo
}

export function defaultSetting(): NoticeState {
  return {
		noticeInfo: {
			id:1,
			title: '公告',
			content: '现已开放ChatGPT4.0模型调用，更多精彩等你发现。</div><div align="center"><img src="http://43.139.70.230:8888/down/XPN5htHyOWik.png" style="display: block; margin: auto auto; width: 200px; height: 200px;"><div style="text-align: center; margin-top: 5px;">扫码加入微信用户群，获取更多AI资讯，</div><br><div>'
			+'<div style="text-align:left"><span>特此声明：熊猫助手仅仅作为AI学习使用,内容均为测试结果,没有任何商业性质,不违反任何法律法规!</span></div>'
    },
  }
}

export function getLocalState(): NoticeState {
  const localSetting: NoticeState | undefined = ss.get(LOCAL_NAME)
  return { ...defaultSetting(), ...localSetting }
}

export function setLocalState(setting: NoticeState): void {
  ss.set(LOCAL_NAME, setting)
}
